<script setup lang="ts">
import btn from "@/utils/buttonInterface";
import {
  Check,
  Delete,
  Edit,
  Message,
  Refresh,
  Search,
  Star,
} from "@element-plus/icons-vue";

const radiusGroup = ref([
  {
    name: "No Radius",
    type: "",
  },
  {
    name: "Small Radius",
    type: "small",
  },
  {
    name: "Large Radius",
    type: "base",
  },
  {
    name: "Round Radius",
    type: "round",
  },
]);

const shadowGroup = ref([
  {
    name: "Basic Shadow",
    type: "",
  },
  {
    name: "Light Shadow",
    type: "light",
  },
  {
    name: "Lighter Shadow",
    type: "lighter",
  },
  {
    name: "Dark Shadow",
    type: "dark",
  },
]);

const getBoxShadow = (type: string) => {
  return `--el-box-shadow${type ? "-" : ""}${type}`;
};

const getBorderRadius = (type: string) => {
  return `${type ? "--el-border-radius-" : ""}${type}`;
};

const input1 = ref("");
const input2 = ref("");
const input3 = ref("");
const select = ref("");

const testInput3Enter = () => {
  console.log("搜索关键词:", input3.value);
};

const vat1 = computed(() => {
  console.log(input3.value);
  return input3.value;
});
</script>

<template>
  <el-container class="debug">
    <div
      class="inline-flex"
      :style="{
        boxShadow: `var(${getBoxShadow(shadowGroup[3].type)})`,
        borderRadius: `var(${getBorderRadius(radiusGroup[3].type)})`,
      }"
    />

    <div class="按钮">
      <el-row class="mb-4">
        <el-button :icon="Refresh" @click="btn.refreshPage">Refresh</el-button>
        <el-button type="primary">Primary</el-button>
        <el-button type="success">Success</el-button>
        <el-button type="info">Info</el-button>
        <el-button type="warning">Warning</el-button>
        <el-button type="danger">Danger</el-button>
      </el-row>

      <el-row class="mb-4">
        <el-button plain>Plain</el-button>
        <el-button type="primary" plain>Primary</el-button>
        <el-button type="success" plain>Success</el-button>
        <el-button type="info" plain>Info</el-button>
        <el-button type="warning" plain>Warning</el-button>
        <el-button type="danger" plain>Danger</el-button>
      </el-row>

      <el-row class="mb-4">
        <el-button round>Round</el-button>
        <el-button type="primary" round>Primary</el-button>
        <el-button type="success" round>Success</el-button>
        <el-button type="info" round>Info</el-button>
        <el-button type="warning" round>Warning</el-button>
        <el-button type="danger" round>Danger</el-button>
      </el-row>

      <el-row>
        <el-button :icon="Search" circle />
        <el-button type="primary" :icon="Edit" circle />
        <el-button type="success" :icon="Check" circle />
        <el-button type="info" :icon="Message" circle />
        <el-button type="warning" :icon="Star" circle />
        <el-button type="danger" :icon="Delete" circle />
      </el-row>
    </div>

    <div class="输入框">
      <div>
        <el-input v-model="input1" placeholder="Please input">
          <template #prepend>Http://</template>
        </el-input>
      </div>

      <div class="mt-4">
        <el-input v-model="input2" placeholder="Please input">
          <template #append>.com</template>
        </el-input>
      </div>

      <div class="mt-4">
        <el-input
          v-model="input3"
          placeholder="Please input"
          class="input-with-select"
        >
          <template #prepend>
            <el-select
              v-model="select"
              placeholder="Select"
              style="width: 115px"
            >
              <el-option label="Restaurant" value="1" />
              <el-option label="Order No." value="2" />
              <el-option label="Tel" value="3" />
            </el-select>
          </template>
          <template #append>
            <el-button :icon="Search" />
          </template>
        </el-input>
      </div>

      <div class="mt-4">
        <el-input
          v-model="input3"
          placeholder="第四个输入栏"
          class="input-with-select"
          @keydown.native.enter="testInput3Enter"
        >
          <template #prepend>
            <el-button :icon="Search" />
          </template>
          <template #append>
            <el-select
              v-model="select"
              placeholder="Select"
              style="width: 115px"
            >
              <el-option label="Restaurant" value="1" />
              <el-option label="Order No." value="2" />
              <el-option label="Tel" value="3" />
            </el-select>
          </template>
        </el-input>
      </div>
    </div>
  </el-container>
</template>

<style scoped>
.debug {
  display: inline-table;
  height: 100%;
  width: 100%;
  background-color: #545c64; /* #545c64*/
}

.debug .radius {
  width: 100%;
  background-color: #545c64; /* #545c64*/
  border: 2px solid var(--el-border-color);
  border-radius: 0;
  margin: 20px;
}

.inline-flex {
  width: 40px;
  height: 40px;
}

.input-with-select .el-input-group__prepend {
  background-color: var(--el-fill-color-blank);
}
</style>
